package com.fr.report.script.function;

import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;
import com.fr.report.script.Primitive;

public class STARTWITH extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    if (paramArrayOfObject.length != 2)
      return Primitive.ERROR_VALUE;
    String str1 = paramArrayOfObject[0].toString();
    String str2 = paramArrayOfObject[1].toString();
    return Boolean.valueOf(str1.startsWith(str2));
  }

  public Function.Type getType()
  {
    return Function.TEXT;
  }

  public String getCN()
  {
    return "STARTWITH(str1，str2):判断字符串str1是否以str2开始。\n备注:\n    str1和str2都是大小写敏感的。\n示例:\nSTARTWITH(\"FineReport\",\"Fine\")等于true。\nSTARTWITH(\"FineReport\",\"Report\")等于false。\nSTARTWITH(\"FineReport\"，\"Fine\")等于false。";
  }

  public String getEN()
  {
    return "STARTWITH(string1,string2):Judge whether string1 starts with string2.\nIf string1 starts with string2,return true,else return false.\n\nRemarks:\nThe two strings are all Case-insensitive.\n\nExample:\nSTARTWITH(\"FineReport\",\"Fine\") returns true.\nSTARTWITH(\"FineReport\",\"Report\") returns false.\nSTARTWITH(\"FineReport\",\"fine\") returns false. ";
  }
}